﻿<%@ Page Language="C#" MasterPageFile="~/Theme/Stander/Stander.master" 
    AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Media_Default" %>
<%@ Import Namespace="Active.Core" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<h2>搜索信息</h2>
<p>
<asp:DropDownList ID="ddlRegions" runat="server" 
    DataSourceID="RegionsCslaDataSource" DataValueField="Id" DataTextField="Name" 
     AutoPostBack="true" AppendDataBoundItems="true" 
     OnSelectedIndexChanged="ddlRegions_SelectedIndexChanged">
    <asp:ListItem Selected="True" Text="所有区域" Value="0"></asp:ListItem>
</asp:DropDownList>
<asp:Label ID="Label1" runat="server" Text="名称："></asp:Label>
<asp:TextBox ID="txtSearchName" runat="server"></asp:TextBox>
<asp:Button ID="btnSearch" runat="server" Text="搜索" OnClick="btnSearch_Click" />
</p>
<csla:CslaDataSource ID="RegionsCslaDataSource" runat="server" 
    TypeName="Active.Core.Regions, Active.Core" OnSelectObject="RegionsCslaDataSource_SelectObject"
    TypeSupportsPaging="False" TypeSupportsSorting="False">
</csla:CslaDataSource>
<h2>媒介列表</h2>
<asp:GridView id="MediasGridView" runat="server" CssClass="normal mouseOver" 
    AutoGenerateColumns="False" DataKeyNames="Id" AllowPaging="True" PageSize="20"
    DataSourceID="MediasDataSource" EnableViewState="false">
    <Columns>
        <asp:HyperLinkField DataNavigateUrlFields="Id" 
            DataNavigateUrlFormatString="Media.aspx?id={0}" DataTextField="Name" HeaderText="媒介" />
        <asp:TemplateField HeaderText="类型">
            <ItemTemplate>
                <asp:Label ID="CategoryLabel" runat="server" Text='<%# ((MediaType)Eval("Category")) == MediaType.TV ? "电视" : "刊物" %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <%--<asp:HyperLinkField DataNavigateUrlFields="Id"
            DataNavigateUrlFormatString="~/Users/ContactList.aspx?companyId={0}"
            Text="联系人" HeaderText="联系人" />--%>
        <asp:HyperLinkField DataNavigateUrlFields="Id"
            DataNavigateUrlFormatString="~/Bill/OrderList.aspx?mediaId={0}"
            DataTextField="DealTimes" HeaderText="交易次数" />
        <asp:HyperLinkField DataNavigateUrlFields="Id" ItemStyle-CssClass="right" 
            DataNavigateUrlFormatString="~/Media/MediaAdvances.aspx?id={0}"
            DataTextField="Advance" DataTextFormatString="{0:c}" HeaderText="预付款" />
        <asp:HyperLinkField DataNavigateUrlFields="Id" ItemStyle-CssClass="right" 
            DataNavigateUrlFormatString="~/Media/MediaBrokerages.aspx?id={0}"
            DataTextField="Brokerage" DataTextFormatString="{0:c}" HeaderText="剩余返点" />
    </Columns>
    <EmptyDataTemplate>
        暂无媒介信息.
    </EmptyDataTemplate>
</asp:GridView>
<csla:CslaDataSource ID="MediasDataSource" runat="server" 
    TypeName="Active.Core.MediaList, Active.Core" OnSelectObject="MediasDataSource_SelectObject"
    TypeSupportsPaging="False" TypeSupportsSorting="False">
</csla:CslaDataSource>
<webdiyer:aspnetpager id="aspnetPager" runat="server" OnPageChanged="aspnetPager_PageChanged"
    PageSize="15"></webdiyer:aspnetpager>
</asp:Content>

